<?php
namespace app\common\model;



use app\admin\controller\Money;
use think\Model;

class Recharge extends Model
{


    public function getStatusTextAttr($value,$data)
    {
        $status = Money::$recharge_status;
        return $status[$data['status']];
    }

    public function user()
    {
        return $this->hasOne(Users::class, 'user_id', 'user_id');
    }

    public function config()
    {
        return $this->hasOne(RechargeConfig::class, 'r_id', 'r_id');
    }


    public function getList($where = []){
        return $this->alias('a')
            ->join('users u','u.user_id = a.user_id','left')
            ->where($where)
            ->field('a.*')
            ->order('a.id desc')
            ->paginate('',false,['query'=>request()->param()]);
    }


}